<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-wms__task}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.taskId" placeholder="taskId" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('wms:task:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('wms:task:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="taskId" label="id" header-align="center" align="center"></el-table-column>
        <el-table-column prop="taskSt" label="任务状态" header-align="center" align="center"></el-table-column>
        <el-table-column prop="taskType" label="业务类型" header-align="center" align="center"></el-table-column>
        <el-table-column prop="taskSubType" label="子类型" header-align="center" align="center"></el-table-column>
        <el-table-column prop="originContNo" label="原始托盘" header-align="center" align="center"></el-table-column>
        <el-table-column prop="targetContNo" label="目标托盘" header-align="center" align="center"></el-table-column>
        <el-table-column prop="spuNo" label="商品编号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="lotNo" label="批次" header-align="center" align="center"></el-table-column>
        <el-table-column prop="planQnty" label="计划量" header-align="center" align="center"></el-table-column>
        <el-table-column prop="actlQnty" label="实际量" header-align="center" align="center"></el-table-column>
        <el-table-column prop="originPosition" label="起始位置" header-align="center" align="center"></el-table-column>
        <el-table-column prop="targetPosition" label="目标位置" header-align="center" align="center"></el-table-column>
        <el-table-column prop="currentPosition" label="当前位置" header-align="center" align="center"></el-table-column>
        <el-table-column prop="mtId" label="主单Id" header-align="center" align="center"></el-table-column>
        <el-table-column prop="mtNo" label="主单编号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="detailId" label="明细id" header-align="center" align="center"></el-table-column>
        <el-table-column prop="stockId" label="相关库存" header-align="center" align="center"></el-table-column>
        <el-table-column prop="creator" label="创建用户" header-align="center" align="center"></el-table-column>
        <el-table-column prop="createDate" label="创建日期" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updater" label="更新用户" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updateDate" label="更新日期" header-align="center" align="center"></el-table-column>
        <el-table-column prop="comments" label="备注" header-align="center" align="center"></el-table-column>
        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="100">
          <template slot-scope="scope">
            <el-button v-if="$hasPermission('wms:task:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.taskId)">{{ $t('update') }}</el-button>
            <el-button v-if="$hasPermission('wms:task:delete')" type="text" size="small" @click="deleteHandle(scope.row.taskId)">{{ $t('delete') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/wms/task/page',
        getDataListIsPage: true,
        exportURL: '/wms/task/export',
        deleteURL: '/wms/task',
        deleteIsBatch: true
      },
      dataForm: {
        taskId: ''
      }
    }
  }
}
</script>
